package Chapter05.cak;

import java.util.Scanner;

public class EpidemicControls {
    private static int confirmed = 0;
    private static int suspected = 0;
    private static int cured = 0;
    private static int dead = 0;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("请选择操作：");
            System.out.println("1.录入疫情数据");
            System.out.println("2.展示疫情数据");
            System.out.println("3.导出疫情数据");
            System.out.println("4.退出程序");
            int choice = scanner.nextInt();
            switch (choice) {
                case 1:
                    inputEpidemicData(scanner);
                    System.out.println("数据录入成功！");
                    break;
                case 2:
                    showEpidemicData();
                    break;
                case 3:
                    exportEpidemicData();
                    System.out.println("数据导出成功！");
                    break;
                case 4:
                    System.out.println("程序已退出！");
                    return;
                default:
                    System.out.println("输入不合法，请重新选择！");
            }
        }
    }

    private static void inputEpidemicData(Scanner scanner) {
        System.out.println("请输入新增确诊人数：");
        int newConfirmed = scanner.nextInt();
        System.out.println("请输入新增疑似人数：");
        int newSuspected = scanner.nextInt();
        System.out.println("请输入新增治愈人数：");
        int newCured = scanner.nextInt();
        System.out.println("请输入新增死亡人数：");
        int newDead = scanner.nextInt();
        confirmed += newConfirmed;
        suspected += newSuspected;
        cured += newCured;
        dead += newDead;
    }

    private static void showEpidemicData() {
        System.out.println("截至目前，累计确诊人数为：" + confirmed);
        System.out.println("截至目前，累计疑似人数为：" + suspected);
        System.out.println("截至目前，累计治愈人数为：" + cured);
        System.out.println("截至目前，累计死亡人数为：" + dead);
    }

    private static void exportEpidemicData() {
        // TODO: 实现数据导出功能，可以将数据保存到文件或上传到云端存储等
    }
}